//
//  StudentModel.m
//  03.14-SaveData
//
//  Created by student on 16/3/14.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "StudentModel.h"
#define kStuId @"StuId"
#define kStuName @"StuName"
#define kStuAge @"StuAge"

@implementation StudentModel
-(instancetype)initWithId:(NSString *)tmpStuId andName:(NSString *)tmpStuName andAge:(NSString *)tmpStuAge
{
    self=[super init];
    if (self) {
        self.stuId=tmpStuId;
        self.stuName=tmpStuName;
        self.stuAge=tmpStuAge;
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.stuId forKey:kStuId];
    [aCoder encodeObject:self.stuName forKey:kStuName];
    [aCoder encodeObject:self.stuAge  forKey:kStuAge];
}

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self=[super init];
    
    if (self) {
       self.stuId= [aDecoder decodeObjectForKey:kStuId];
       self.stuName= [aDecoder decodeObjectForKey:kStuName];
        self.stuAge=[aDecoder decodeObjectForKey:kStuAge];
    }
    return self;
    
}
-(NSString *)description
{
    return [NSString stringWithFormat:@"%@ %@ %@",self.stuId,self.stuName,self.stuAge];
}







@end
